package com.jeecg.demo.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.ResponseMessages;
import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.jwt.util.Results;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Api(value = "trader", description = "交易商", tags = "trader")
@Controller
@RequestMapping("/trader")
public class Trader {
    @Autowired
    private SystemService systemService;

    /**
     * 交易商
     */
    @RequestMapping(value = "/order",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "交易商", produces = "application/json")
    public ResponseMessage<List<Map<String, Object>>> market(HttpServletRequest request) {
        String sql = " SELECT\n" +
                "\t*\n" +
                "FROM\n" +
                "\tTRADER\n" +
                "WHERE\n" +
                "\ttrader.TRADERAUTHSTATUS = 3 ";
        List<Map<String, Object>> listMap = systemService.findForJdbc(sql);
        return Result.success(listMap);
    }



    /**
     * 煤种信息
     */
    @RequestMapping(value = "/variety",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "煤种信息", produces = "application/json")
    public ResponseMessage<List<Map<String, Object>>> variety(HttpServletRequest request) {
        String sql = " select VARIETYCODE,VARIETYNAME from commodityvariety where sectorid = '6' ";
        List<Map<String, Object>> listMap = systemService.findForJdbc(sql);
        return Result.success(listMap);
    }
}
